package com.ims.controller;

import com.ims.pojo.UserRoleCor;
import com.ims.service.UserRoleCorService;
import com.ims.util.Result;
import com.ims.util.StatusCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: zk
 * @date: 2022/9/9 23:37
 */
@RestController
@RequestMapping("/userRole")
public class UserRoleController {

    @Autowired
    private UserRoleCorService userRoleCorService;

    @PostMapping("/add")
    public Result add(Integer userId, Integer roleId) {
        UserRoleCor userRoleCor = new UserRoleCor();
        userRoleCor.setUserId(userId);
        userRoleCor.setRoleId(roleId);
        userRoleCorService.save(userRoleCor);
        return new Result(true, StatusCode.OK, "添加成功");
    }
}
